
_ln:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
#include "stat.h"
#include "user.h"

int
main(int argc, char *argv[])
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	53                   	push   %ebx
   4:	83 e4 f0             	and    $0xfffffff0,%esp
   7:	83 ec 10             	sub    $0x10,%esp
   a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  if(argc != 3){
   d:	83 7d 08 03          	cmpl   $0x3,0x8(%ebp)
  11:	74 19                	je     2c <main+0x2c>
    printf(2, "Usage: ln old new\n");
  13:	c7 44 24 04 e6 06 00 	movl   $0x6e6,0x4(%esp)
  1a:	00 
  1b:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  22:	e8 f9 03 00 00       	call   420 <printf>
    exit();
  27:	e8 a8 02 00 00       	call   2d4 <exit>
  }
  if(link(argv[1], argv[2]) < 0)
  2c:	8b 43 08             	mov    0x8(%ebx),%eax
  2f:	89 44 24 04          	mov    %eax,0x4(%esp)
  33:	8b 43 04             	mov    0x4(%ebx),%eax
  36:	89 04 24             	mov    %eax,(%esp)
  39:	e8 f6 02 00 00       	call   334 <link>
  3e:	85 c0                	test   %eax,%eax
  40:	78 05                	js     47 <main+0x47>
    printf(2, "link %s %s: failed\n", argv[1], argv[2]);
  exit();
  42:	e8 8d 02 00 00       	call   2d4 <exit>
  if(argc != 3){
    printf(2, "Usage: ln old new\n");
    exit();
  }
  if(link(argv[1], argv[2]) < 0)
    printf(2, "link %s %s: failed\n", argv[1], argv[2]);
  47:	8b 43 08             	mov    0x8(%ebx),%eax
  4a:	89 44 24 0c          	mov    %eax,0xc(%esp)
  4e:	8b 43 04             	mov    0x4(%ebx),%eax
  51:	c7 44 24 04 f9 06 00 	movl   $0x6f9,0x4(%esp)
  58:	00 
  59:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  60:	89 44 24 08          	mov    %eax,0x8(%esp)
  64:	e8 b7 03 00 00       	call   420 <printf>
  69:	eb d7                	jmp    42 <main+0x42>
  6b:	90                   	nop
  6c:	90                   	nop
  6d:	90                   	nop
  6e:	90                   	nop
  6f:	90                   	nop

00000070 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  70:	53                   	push   %ebx
  71:	8b 44 24 08          	mov    0x8(%esp),%eax
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  75:	31 d2                	xor    %edx,%edx
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  77:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
  7b:	90                   	nop
  7c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  80:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
  84:	88 0c 10             	mov    %cl,(%eax,%edx,1)
  87:	83 c2 01             	add    $0x1,%edx
  8a:	84 c9                	test   %cl,%cl
  8c:	75 f2                	jne    80 <strcpy+0x10>
    ;
  return os;
}
  8e:	5b                   	pop    %ebx
  8f:	c3                   	ret    

00000090 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  90:	56                   	push   %esi
  91:	53                   	push   %ebx
  92:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  96:	8b 54 24 10          	mov    0x10(%esp),%edx
  while(*p && *p == *q)
  9a:	0f b6 01             	movzbl (%ecx),%eax
  9d:	0f b6 1a             	movzbl (%edx),%ebx
  a0:	84 c0                	test   %al,%al
  a2:	74 24                	je     c8 <strcmp+0x38>
  a4:	38 d8                	cmp    %bl,%al
  a6:	74 11                	je     b9 <strcmp+0x29>
  a8:	eb 2e                	jmp    d8 <strcmp+0x48>
  aa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  b0:	83 c1 01             	add    $0x1,%ecx
  b3:	38 d8                	cmp    %bl,%al
  b5:	75 21                	jne    d8 <strcmp+0x48>
    p++, q++;
  b7:	89 f2                	mov    %esi,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  b9:	0f b6 41 01          	movzbl 0x1(%ecx),%eax
    p++, q++;
  bd:	8d 72 01             	lea    0x1(%edx),%esi
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  c0:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
  c4:	84 c0                	test   %al,%al
  c6:	75 e8                	jne    b0 <strcmp+0x20>
    p++, q++;
  return (uchar)*p - (uchar)*q;
  c8:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  cb:	31 c0                	xor    %eax,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  cd:	29 d8                	sub    %ebx,%eax
}
  cf:	5b                   	pop    %ebx
  d0:	5e                   	pop    %esi
  d1:	c3                   	ret    
  d2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    p++, q++;
  return (uchar)*p - (uchar)*q;
  d8:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  db:	0f b6 c0             	movzbl %al,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  de:	29 d8                	sub    %ebx,%eax
}
  e0:	5b                   	pop    %ebx
  e1:	5e                   	pop    %esi
  e2:	c3                   	ret    
  e3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  e9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000000f0 <strlen>:

uint
strlen(char *s)
{
  f0:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  int n;

  for(n = 0; s[n]; n++)
  f4:	31 c0                	xor    %eax,%eax
  f6:	80 39 00             	cmpb   $0x0,(%ecx)
  f9:	74 10                	je     10b <strlen+0x1b>
  fb:	31 d2                	xor    %edx,%edx
  fd:	8d 76 00             	lea    0x0(%esi),%esi
 100:	83 c2 01             	add    $0x1,%edx
 103:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
 107:	89 d0                	mov    %edx,%eax
 109:	75 f5                	jne    100 <strlen+0x10>
    ;
  return n;
}
 10b:	f3 c3                	repz ret 
 10d:	8d 76 00             	lea    0x0(%esi),%esi

00000110 <memset>:

void*
memset(void *dst, int c, uint n)
{
 110:	57                   	push   %edi
 111:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
 115:	8b 4c 24 10          	mov    0x10(%esp),%ecx
 119:	8b 44 24 0c          	mov    0xc(%esp),%eax
 11d:	89 d7                	mov    %edx,%edi
 11f:	fc                   	cld    
 120:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
 122:	89 d0                	mov    %edx,%eax
 124:	5f                   	pop    %edi
 125:	c3                   	ret    
 126:	8d 76 00             	lea    0x0(%esi),%esi
 129:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000130 <strchr>:

char*
strchr(const char *s, char c)
{
 130:	8b 44 24 04          	mov    0x4(%esp),%eax
 134:	0f b6 4c 24 08       	movzbl 0x8(%esp),%ecx
  for(; *s; s++)
 139:	0f b6 10             	movzbl (%eax),%edx
 13c:	84 d2                	test   %dl,%dl
 13e:	74 1d                	je     15d <strchr+0x2d>
    if(*s == c)
 140:	38 ca                	cmp    %cl,%dl
 142:	75 0e                	jne    152 <strchr+0x22>
 144:	eb 1c                	jmp    162 <strchr+0x32>
 146:	66 90                	xchg   %ax,%ax
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 148:	83 c0 01             	add    $0x1,%eax
    if(*s == c)
 14b:	38 ca                	cmp    %cl,%dl
 14d:	8d 76 00             	lea    0x0(%esi),%esi
 150:	74 0e                	je     160 <strchr+0x30>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 152:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 156:	84 d2                	test   %dl,%dl
 158:	75 ee                	jne    148 <strchr+0x18>
    if(*s == c)
      return (char*) s;
  return 0;
 15a:	31 c0                	xor    %eax,%eax
 15c:	c3                   	ret    
 15d:	31 c0                	xor    %eax,%eax
 15f:	90                   	nop
}
 160:	f3 c3                	repz ret 
 162:	f3 c3                	repz ret 
 164:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 16a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000170 <gets>:

char*
gets(char *buf, int max)
{
 170:	55                   	push   %ebp
 171:	57                   	push   %edi
 172:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 173:	31 f6                	xor    %esi,%esi
  return 0;
}

char*
gets(char *buf, int max)
{
 175:	53                   	push   %ebx
 176:	83 ec 2c             	sub    $0x2c,%esp
 179:	8b 7c 24 40          	mov    0x40(%esp),%edi
 17d:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 181:	eb 38                	jmp    1bb <gets+0x4b>
 183:	90                   	nop
 184:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    cc = read(0, &c, 1);
 188:	8d 44 24 1f          	lea    0x1f(%esp),%eax
 18c:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 193:	00 
 194:	89 44 24 04          	mov    %eax,0x4(%esp)
 198:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 19f:	e8 48 01 00 00       	call   2ec <read>
    if(cc < 1)
 1a4:	85 c0                	test   %eax,%eax
 1a6:	7e 1a                	jle    1c2 <gets+0x52>
      break;
    buf[i++] = c;
 1a8:	0f b6 44 24 1f       	movzbl 0x1f(%esp),%eax
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 1ad:	89 de                	mov    %ebx,%esi
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 1af:	3c 0d                	cmp    $0xd,%al

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
 1b1:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
 1b5:	74 0b                	je     1c2 <gets+0x52>
 1b7:	3c 0a                	cmp    $0xa,%al
 1b9:	74 07                	je     1c2 <gets+0x52>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 1bb:	8d 5e 01             	lea    0x1(%esi),%ebx
 1be:	39 eb                	cmp    %ebp,%ebx
 1c0:	7c c6                	jl     188 <gets+0x18>
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
 1c2:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
 1c6:	83 c4 2c             	add    $0x2c,%esp
 1c9:	89 f8                	mov    %edi,%eax
 1cb:	5b                   	pop    %ebx
 1cc:	5e                   	pop    %esi
 1cd:	5f                   	pop    %edi
 1ce:	5d                   	pop    %ebp
 1cf:	c3                   	ret    

000001d0 <stat>:

int
stat(char *n, struct statt *st)
{
 1d0:	83 ec 1c             	sub    $0x1c,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1d3:	8b 44 24 20          	mov    0x20(%esp),%eax
  return buf;
}

int
stat(char *n, struct statt *st)
{
 1d7:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 1db:	89 74 24 18          	mov    %esi,0x18(%esp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
 1df:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1e4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 1eb:	00 
 1ec:	89 04 24             	mov    %eax,(%esp)
 1ef:	e8 20 01 00 00       	call   314 <open>
  if(fd < 0)
 1f4:	85 c0                	test   %eax,%eax
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1f6:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
 1f8:	78 1a                	js     214 <stat+0x44>
    return -1;
  r = fstat(fd, st);
 1fa:	8b 44 24 24          	mov    0x24(%esp),%eax
 1fe:	89 1c 24             	mov    %ebx,(%esp)
 201:	89 44 24 04          	mov    %eax,0x4(%esp)
 205:	e8 22 01 00 00       	call   32c <fstat>
  close(fd);
 20a:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
 20d:	89 c6                	mov    %eax,%esi
  close(fd);
 20f:	e8 e8 00 00 00       	call   2fc <close>
  return r;
}
 214:	89 f0                	mov    %esi,%eax
 216:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 21a:	8b 74 24 18          	mov    0x18(%esp),%esi
 21e:	83 c4 1c             	add    $0x1c,%esp
 221:	c3                   	ret    
 222:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 229:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000230 <atoi>:

int
atoi(const char *s)
{
 230:	53                   	push   %ebx
 231:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  int n;

  n = 0;
 235:	31 c0                	xor    %eax,%eax
  while('0' <= *s && *s <= '9')
 237:	0f b6 11             	movzbl (%ecx),%edx
 23a:	8d 5a d0             	lea    -0x30(%edx),%ebx
 23d:	80 fb 09             	cmp    $0x9,%bl
 240:	77 1e                	ja     260 <atoi+0x30>
 242:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    n = n*10 + *s++ - '0';
 248:	0f be d2             	movsbl %dl,%edx
 24b:	83 c1 01             	add    $0x1,%ecx
 24e:	8d 04 80             	lea    (%eax,%eax,4),%eax
 251:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 255:	0f b6 11             	movzbl (%ecx),%edx
 258:	8d 5a d0             	lea    -0x30(%edx),%ebx
 25b:	80 fb 09             	cmp    $0x9,%bl
 25e:	76 e8                	jbe    248 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
 260:	5b                   	pop    %ebx
 261:	c3                   	ret    
 262:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 269:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000270 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 270:	56                   	push   %esi
 271:	53                   	push   %ebx
 272:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 276:	8b 44 24 0c          	mov    0xc(%esp),%eax
 27a:	8b 74 24 10          	mov    0x10(%esp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 27e:	85 db                	test   %ebx,%ebx
 280:	7e 14                	jle    296 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
 282:	31 d2                	xor    %edx,%edx
 284:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
 288:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 28c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 28f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 292:	39 da                	cmp    %ebx,%edx
 294:	75 f2                	jne    288 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
 296:	5b                   	pop    %ebx
 297:	5e                   	pop    %esi
 298:	c3                   	ret    
 299:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

000002a0 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
 2a0:	56                   	push   %esi
 2a1:	53                   	push   %ebx
 2a2:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 2a6:	8b 44 24 0c          	mov    0xc(%esp),%eax
 2aa:	8b 74 24 10          	mov    0x10(%esp),%esi
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 2ae:	85 db                	test   %ebx,%ebx
 2b0:	7e 14                	jle    2c6 <memcpy+0x26>
 2b2:	31 d2                	xor    %edx,%edx
 2b4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    *dst++ = *src++;
 2b8:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 2bc:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 2bf:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 2c2:	39 da                	cmp    %ebx,%edx
 2c4:	75 f2                	jne    2b8 <memcpy+0x18>

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
}
 2c6:	5b                   	pop    %ebx
 2c7:	5e                   	pop    %esi
 2c8:	c3                   	ret    
 2c9:	90                   	nop
 2ca:	90                   	nop
 2cb:	90                   	nop

000002cc <fork>:
 2cc:	b8 01 00 00 00       	mov    $0x1,%eax
 2d1:	cd 40                	int    $0x40
 2d3:	c3                   	ret    

000002d4 <exit>:
 2d4:	b8 02 00 00 00       	mov    $0x2,%eax
 2d9:	cd 40                	int    $0x40
 2db:	c3                   	ret    

000002dc <wait>:
 2dc:	b8 03 00 00 00       	mov    $0x3,%eax
 2e1:	cd 40                	int    $0x40
 2e3:	c3                   	ret    

000002e4 <pipe>:
 2e4:	b8 04 00 00 00       	mov    $0x4,%eax
 2e9:	cd 40                	int    $0x40
 2eb:	c3                   	ret    

000002ec <read>:
 2ec:	b8 06 00 00 00       	mov    $0x6,%eax
 2f1:	cd 40                	int    $0x40
 2f3:	c3                   	ret    

000002f4 <write>:
 2f4:	b8 05 00 00 00       	mov    $0x5,%eax
 2f9:	cd 40                	int    $0x40
 2fb:	c3                   	ret    

000002fc <close>:
 2fc:	b8 07 00 00 00       	mov    $0x7,%eax
 301:	cd 40                	int    $0x40
 303:	c3                   	ret    

00000304 <kill>:
 304:	b8 08 00 00 00       	mov    $0x8,%eax
 309:	cd 40                	int    $0x40
 30b:	c3                   	ret    

0000030c <exec>:
 30c:	b8 09 00 00 00       	mov    $0x9,%eax
 311:	cd 40                	int    $0x40
 313:	c3                   	ret    

00000314 <open>:
 314:	b8 0a 00 00 00       	mov    $0xa,%eax
 319:	cd 40                	int    $0x40
 31b:	c3                   	ret    

0000031c <mknod>:
 31c:	b8 0b 00 00 00       	mov    $0xb,%eax
 321:	cd 40                	int    $0x40
 323:	c3                   	ret    

00000324 <unlink>:
 324:	b8 0c 00 00 00       	mov    $0xc,%eax
 329:	cd 40                	int    $0x40
 32b:	c3                   	ret    

0000032c <fstat>:
 32c:	b8 0d 00 00 00       	mov    $0xd,%eax
 331:	cd 40                	int    $0x40
 333:	c3                   	ret    

00000334 <link>:
 334:	b8 0e 00 00 00       	mov    $0xe,%eax
 339:	cd 40                	int    $0x40
 33b:	c3                   	ret    

0000033c <mkdir>:
 33c:	b8 0f 00 00 00       	mov    $0xf,%eax
 341:	cd 40                	int    $0x40
 343:	c3                   	ret    

00000344 <chdir>:
 344:	b8 10 00 00 00       	mov    $0x10,%eax
 349:	cd 40                	int    $0x40
 34b:	c3                   	ret    

0000034c <dup>:
 34c:	b8 11 00 00 00       	mov    $0x11,%eax
 351:	cd 40                	int    $0x40
 353:	c3                   	ret    

00000354 <getpid>:
 354:	b8 12 00 00 00       	mov    $0x12,%eax
 359:	cd 40                	int    $0x40
 35b:	c3                   	ret    

0000035c <sbrk>:
 35c:	b8 13 00 00 00       	mov    $0x13,%eax
 361:	cd 40                	int    $0x40
 363:	c3                   	ret    

00000364 <sleep>:
 364:	b8 14 00 00 00       	mov    $0x14,%eax
 369:	cd 40                	int    $0x40
 36b:	c3                   	ret    
 36c:	90                   	nop
 36d:	90                   	nop
 36e:	90                   	nop
 36f:	90                   	nop

00000370 <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
 370:	83 ec 2c             	sub    $0x2c,%esp
 373:	88 54 24 1c          	mov    %dl,0x1c(%esp)
  write(fd, &c, 1);
 377:	8d 54 24 1c          	lea    0x1c(%esp),%edx
 37b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 382:	00 
 383:	89 54 24 04          	mov    %edx,0x4(%esp)
 387:	89 04 24             	mov    %eax,(%esp)
 38a:	e8 65 ff ff ff       	call   2f4 <write>
}
 38f:	83 c4 2c             	add    $0x2c,%esp
 392:	c3                   	ret    
 393:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 399:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000003a0 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 3a0:	57                   	push   %edi
 3a1:	56                   	push   %esi
 3a2:	53                   	push   %ebx
 3a3:	89 c3                	mov    %eax,%ebx
 3a5:	83 ec 10             	sub    $0x10,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 3a8:	8b 44 24 20          	mov    0x20(%esp),%eax
 3ac:	85 c0                	test   %eax,%eax
 3ae:	74 60                	je     410 <printint+0x70>
 3b0:	89 d0                	mov    %edx,%eax
 3b2:	c1 e8 1f             	shr    $0x1f,%eax
 3b5:	84 c0                	test   %al,%al
 3b7:	74 57                	je     410 <printint+0x70>
    neg = 1;
    x = -xx;
 3b9:	89 d0                	mov    %edx,%eax
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
 3bb:	bf 01 00 00 00       	mov    $0x1,%edi
    x = -xx;
 3c0:	f7 d8                	neg    %eax
  } else {
    x = xx;
  }

  i = 0;
 3c2:	31 f6                	xor    %esi,%esi
 3c4:	eb 04                	jmp    3ca <printint+0x2a>
 3c6:	66 90                	xchg   %ax,%ax
  do{
    buf[i++] = digits[x % base];
 3c8:	89 d6                	mov    %edx,%esi
 3ca:	31 d2                	xor    %edx,%edx
 3cc:	f7 f1                	div    %ecx
 3ce:	0f b6 92 14 07 00 00 	movzbl 0x714(%edx),%edx
  }while((x /= base) != 0);
 3d5:	85 c0                	test   %eax,%eax
    x = xx;
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 3d7:	88 14 34             	mov    %dl,(%esp,%esi,1)
 3da:	8d 56 01             	lea    0x1(%esi),%edx
  }while((x /= base) != 0);
 3dd:	75 e9                	jne    3c8 <printint+0x28>
  if(neg)
 3df:	85 ff                	test   %edi,%edi
 3e1:	74 07                	je     3ea <printint+0x4a>
    buf[i++] = '-';
 3e3:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
 3e7:	8d 56 02             	lea    0x2(%esi),%edx

  while(--i >= 0)
 3ea:	8d 72 ff             	lea    -0x1(%edx),%esi
 3ed:	8d 76 00             	lea    0x0(%esi),%esi
    putc(fd, buf[i]);
 3f0:	0f be 14 34          	movsbl (%esp,%esi,1),%edx
 3f4:	89 d8                	mov    %ebx,%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3f6:	83 ee 01             	sub    $0x1,%esi
    putc(fd, buf[i]);
 3f9:	e8 72 ff ff ff       	call   370 <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3fe:	83 fe ff             	cmp    $0xffffffff,%esi
 401:	75 ed                	jne    3f0 <printint+0x50>
    putc(fd, buf[i]);
}
 403:	83 c4 10             	add    $0x10,%esp
 406:	5b                   	pop    %ebx
 407:	5e                   	pop    %esi
 408:	5f                   	pop    %edi
 409:	c3                   	ret    
 40a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 410:	89 d0                	mov    %edx,%eax
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
 412:	31 ff                	xor    %edi,%edi
 414:	eb ac                	jmp    3c2 <printint+0x22>
 416:	8d 76 00             	lea    0x0(%esi),%esi
 419:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000420 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 420:	55                   	push   %ebp
 421:	57                   	push   %edi
 422:	56                   	push   %esi
 423:	53                   	push   %ebx
 424:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 427:	8b 5c 24 44          	mov    0x44(%esp),%ebx
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 42b:	8b 6c 24 40          	mov    0x40(%esp),%ebp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 42f:	0f b6 0b             	movzbl (%ebx),%ecx
 432:	84 c9                	test   %cl,%cl
 434:	0f 84 86 00 00 00    	je     4c0 <printf+0xa0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
 43a:	8d 44 24 48          	lea    0x48(%esp),%eax
{
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
 43e:	31 f6                	xor    %esi,%esi
  ap = (uint*)(void*)&fmt + 1;
 440:	89 44 24 1c          	mov    %eax,0x1c(%esp)
 444:	eb 1b                	jmp    461 <printf+0x41>
 446:	66 90                	xchg   %ax,%ax
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 448:	83 f9 25             	cmp    $0x25,%ecx
 44b:	74 7b                	je     4c8 <printf+0xa8>
        state = '%';
      } else {
        putc(fd, c);
 44d:	0f be d1             	movsbl %cl,%edx
 450:	89 e8                	mov    %ebp,%eax
 452:	e8 19 ff ff ff       	call   370 <putc>
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 457:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 45a:	0f b6 0b             	movzbl (%ebx),%ecx
 45d:	84 c9                	test   %cl,%cl
 45f:	74 5f                	je     4c0 <printf+0xa0>
    c = fmt[i] & 0xff;
    if(state == 0){
 461:	85 f6                	test   %esi,%esi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
 463:	0f b6 c9             	movzbl %cl,%ecx
    if(state == 0){
 466:	74 e0                	je     448 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 468:	83 fe 25             	cmp    $0x25,%esi
 46b:	75 ea                	jne    457 <printf+0x37>
      if(c == 'd'){
 46d:	83 f9 64             	cmp    $0x64,%ecx
 470:	0f 84 ba 00 00 00    	je     530 <printf+0x110>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 476:	83 f9 70             	cmp    $0x70,%ecx
 479:	74 55                	je     4d0 <printf+0xb0>
 47b:	83 f9 78             	cmp    $0x78,%ecx
 47e:	66 90                	xchg   %ax,%ax
 480:	74 4e                	je     4d0 <printf+0xb0>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 482:	83 f9 73             	cmp    $0x73,%ecx
 485:	74 71                	je     4f8 <printf+0xd8>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 487:	83 f9 63             	cmp    $0x63,%ecx
 48a:	0f 84 c3 00 00 00    	je     553 <printf+0x133>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 490:	83 f9 25             	cmp    $0x25,%ecx
        putc(fd, c);
 493:	ba 25 00 00 00       	mov    $0x25,%edx
 498:	89 e8                	mov    %ebp,%eax
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 49a:	74 12                	je     4ae <printf+0x8e>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 49c:	89 4c 24 18          	mov    %ecx,0x18(%esp)
 4a0:	e8 cb fe ff ff       	call   370 <putc>
        putc(fd, c);
 4a5:	8b 4c 24 18          	mov    0x18(%esp),%ecx
 4a9:	89 e8                	mov    %ebp,%eax
 4ab:	0f be d1             	movsbl %cl,%edx
 4ae:	e8 bd fe ff ff       	call   370 <putc>
      }
      state = 0;
 4b3:	31 f6                	xor    %esi,%esi
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 4b5:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 4b8:	0f b6 0b             	movzbl (%ebx),%ecx
 4bb:	84 c9                	test   %cl,%cl
 4bd:	75 a2                	jne    461 <printf+0x41>
 4bf:	90                   	nop
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 4c0:	83 c4 2c             	add    $0x2c,%esp
 4c3:	5b                   	pop    %ebx
 4c4:	5e                   	pop    %esi
 4c5:	5f                   	pop    %edi
 4c6:	5d                   	pop    %ebp
 4c7:	c3                   	ret    
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
 4c8:	be 25 00 00 00       	mov    $0x25,%esi
 4cd:	eb 88                	jmp    457 <printf+0x37>
 4cf:	90                   	nop
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 4d0:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4d4:	b9 10 00 00 00       	mov    $0x10,%ecx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4d9:	31 f6                	xor    %esi,%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 4db:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4e2:	8b 10                	mov    (%eax),%edx
 4e4:	89 e8                	mov    %ebp,%eax
 4e6:	e8 b5 fe ff ff       	call   3a0 <printint>
        ap++;
 4eb:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 4f0:	e9 62 ff ff ff       	jmp    457 <printf+0x37>
 4f5:	8d 76 00             	lea    0x0(%esi),%esi
      } else if(c == 's'){
        s = (char*)*ap;
 4f8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4fc:	8b 38                	mov    (%eax),%edi
        ap++;
 4fe:	83 c0 04             	add    $0x4,%eax
 501:	89 44 24 1c          	mov    %eax,0x1c(%esp)
        if(s == 0)
 505:	85 ff                	test   %edi,%edi
 507:	74 64                	je     56d <printf+0x14d>
          s = "(null)";
        while(*s != 0){
 509:	0f b6 17             	movzbl (%edi),%edx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 50c:	31 f6                	xor    %esi,%esi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 50e:	84 d2                	test   %dl,%dl
 510:	0f 84 41 ff ff ff    	je     457 <printf+0x37>
 516:	66 90                	xchg   %ax,%ax
          putc(fd, *s);
 518:	0f be d2             	movsbl %dl,%edx
          s++;
 51b:	83 c7 01             	add    $0x1,%edi
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
 51e:	89 e8                	mov    %ebp,%eax
 520:	e8 4b fe ff ff       	call   370 <putc>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 525:	0f b6 17             	movzbl (%edi),%edx
 528:	84 d2                	test   %dl,%dl
 52a:	75 ec                	jne    518 <printf+0xf8>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 52c:	31 f6                	xor    %esi,%esi
 52e:	eb 85                	jmp    4b5 <printf+0x95>
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 530:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 534:	b1 0a                	mov    $0xa,%cl
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 536:	66 31 f6             	xor    %si,%si
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 539:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 540:	8b 10                	mov    (%eax),%edx
 542:	89 e8                	mov    %ebp,%eax
 544:	e8 57 fe ff ff       	call   3a0 <printint>
        ap++;
 549:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 54e:	e9 04 ff ff ff       	jmp    457 <printf+0x37>
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 553:	8b 44 24 1c          	mov    0x1c(%esp),%eax
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 557:	31 f6                	xor    %esi,%esi
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 559:	0f be 10             	movsbl (%eax),%edx
 55c:	89 e8                	mov    %ebp,%eax
 55e:	e8 0d fe ff ff       	call   370 <putc>
        ap++;
 563:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 568:	e9 ea fe ff ff       	jmp    457 <printf+0x37>
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
 56d:	bf 0d 07 00 00       	mov    $0x70d,%edi
 572:	eb 95                	jmp    509 <printf+0xe9>
 574:	90                   	nop
 575:	90                   	nop
 576:	90                   	nop
 577:	90                   	nop
 578:	90                   	nop
 579:	90                   	nop
 57a:	90                   	nop
 57b:	90                   	nop
 57c:	90                   	nop
 57d:	90                   	nop
 57e:	90                   	nop
 57f:	90                   	nop

00000580 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 580:	57                   	push   %edi
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 581:	a1 c0 09 00 00       	mov    0x9c0,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
 586:	56                   	push   %esi
 587:	53                   	push   %ebx
 588:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
 58c:	8d 4b f8             	lea    -0x8(%ebx),%ecx
 58f:	90                   	nop
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 590:	39 c8                	cmp    %ecx,%eax
 592:	8b 10                	mov    (%eax),%edx
 594:	73 04                	jae    59a <free+0x1a>
 596:	39 d1                	cmp    %edx,%ecx
 598:	72 16                	jb     5b0 <free+0x30>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 59a:	39 d0                	cmp    %edx,%eax
 59c:	72 08                	jb     5a6 <free+0x26>
 59e:	39 c8                	cmp    %ecx,%eax
 5a0:	72 0e                	jb     5b0 <free+0x30>
 5a2:	39 d1                	cmp    %edx,%ecx
 5a4:	72 0a                	jb     5b0 <free+0x30>
static Header base;
static Header *freep;

void
free(void *ap)
{
 5a6:	89 d0                	mov    %edx,%eax
 5a8:	eb e6                	jmp    590 <free+0x10>
 5aa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 5b0:	8b 73 fc             	mov    -0x4(%ebx),%esi
 5b3:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 5b6:	39 d7                	cmp    %edx,%edi
 5b8:	74 18                	je     5d2 <free+0x52>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 5ba:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
 5bd:	8b 50 04             	mov    0x4(%eax),%edx
 5c0:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 5c3:	39 f1                	cmp    %esi,%ecx
 5c5:	74 22                	je     5e9 <free+0x69>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 5c7:	89 08                	mov    %ecx,(%eax)
  freep = p;
 5c9:	a3 c0 09 00 00       	mov    %eax,0x9c0
}
 5ce:	5b                   	pop    %ebx
 5cf:	5e                   	pop    %esi
 5d0:	5f                   	pop    %edi
 5d1:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 5d2:	03 72 04             	add    0x4(%edx),%esi
 5d5:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
 5d8:	8b 10                	mov    (%eax),%edx
 5da:	8b 12                	mov    (%edx),%edx
 5dc:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 5df:	8b 50 04             	mov    0x4(%eax),%edx
 5e2:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 5e5:	39 f1                	cmp    %esi,%ecx
 5e7:	75 de                	jne    5c7 <free+0x47>
    p->s.size += bp->s.size;
 5e9:	03 53 fc             	add    -0x4(%ebx),%edx
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
  freep = p;
 5ec:	a3 c0 09 00 00       	mov    %eax,0x9c0
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
 5f1:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 5f4:	8b 53 f8             	mov    -0x8(%ebx),%edx
 5f7:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
}
 5f9:	5b                   	pop    %ebx
 5fa:	5e                   	pop    %esi
 5fb:	5f                   	pop    %edi
 5fc:	c3                   	ret    
 5fd:	8d 76 00             	lea    0x0(%esi),%esi

00000600 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 600:	57                   	push   %edi
 601:	56                   	push   %esi
 602:	53                   	push   %ebx
 603:	83 ec 10             	sub    $0x10,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
 606:	8b 15 c0 09 00 00    	mov    0x9c0,%edx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 60c:	8b 5c 24 20          	mov    0x20(%esp),%ebx
 610:	83 c3 07             	add    $0x7,%ebx
 613:	c1 eb 03             	shr    $0x3,%ebx
 616:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
 619:	85 d2                	test   %edx,%edx
 61b:	0f 84 9d 00 00 00    	je     6be <malloc+0xbe>
 621:	8b 02                	mov    (%edx),%eax
 623:	8b 48 04             	mov    0x4(%eax),%ecx
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
 626:	39 d9                	cmp    %ebx,%ecx
 628:	73 6e                	jae    698 <malloc+0x98>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 62a:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 631:	eb 0e                	jmp    641 <malloc+0x41>
 633:	90                   	nop
 634:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 638:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
 63a:	8b 48 04             	mov    0x4(%eax),%ecx
 63d:	39 cb                	cmp    %ecx,%ebx
 63f:	76 57                	jbe    698 <malloc+0x98>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
 641:	3b 05 c0 09 00 00    	cmp    0x9c0,%eax
 647:	89 c2                	mov    %eax,%edx
 649:	75 ed                	jne    638 <malloc+0x38>
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 64b:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 651:	b8 00 80 00 00       	mov    $0x8000,%eax
    nu = PAGE;
 656:	be 00 10 00 00       	mov    $0x1000,%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 65b:	76 04                	jbe    661 <malloc+0x61>
 65d:	89 f8                	mov    %edi,%eax
 65f:	89 de                	mov    %ebx,%esi
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
 661:	89 04 24             	mov    %eax,(%esp)
 664:	e8 f3 fc ff ff       	call   35c <sbrk>
  if(p == (char*) -1)
 669:	83 f8 ff             	cmp    $0xffffffff,%eax
 66c:	74 1a                	je     688 <malloc+0x88>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
 66e:	89 70 04             	mov    %esi,0x4(%eax)
  free((void*)(hp + 1));
 671:	83 c0 08             	add    $0x8,%eax
 674:	89 04 24             	mov    %eax,(%esp)
 677:	e8 04 ff ff ff       	call   580 <free>
  return freep;
 67c:	8b 15 c0 09 00 00    	mov    0x9c0,%edx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
 682:	85 d2                	test   %edx,%edx
 684:	75 b2                	jne    638 <malloc+0x38>
 686:	66 90                	xchg   %ax,%ax
        return 0;
  }
}
 688:	83 c4 10             	add    $0x10,%esp
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
 68b:	31 c0                	xor    %eax,%eax
  }
}
 68d:	5b                   	pop    %ebx
 68e:	5e                   	pop    %esi
 68f:	5f                   	pop    %edi
 690:	c3                   	ret    
 691:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
 698:	39 cb                	cmp    %ecx,%ebx
 69a:	74 1c                	je     6b8 <malloc+0xb8>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
 69c:	29 d9                	sub    %ebx,%ecx
 69e:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
 6a1:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
 6a4:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
 6a7:	89 15 c0 09 00 00    	mov    %edx,0x9c0
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 6ad:	83 c4 10             	add    $0x10,%esp
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 6b0:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 6b3:	5b                   	pop    %ebx
 6b4:	5e                   	pop    %esi
 6b5:	5f                   	pop    %edi
 6b6:	c3                   	ret    
 6b7:	90                   	nop
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
 6b8:	8b 08                	mov    (%eax),%ecx
 6ba:	89 0a                	mov    %ecx,(%edx)
 6bc:	eb e9                	jmp    6a7 <malloc+0xa7>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 6be:	c7 05 c0 09 00 00 c4 	movl   $0x9c4,0x9c0
 6c5:	09 00 00 
    base.s.size = 0;
 6c8:	b8 c4 09 00 00       	mov    $0x9c4,%eax
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 6cd:	c7 05 c4 09 00 00 c4 	movl   $0x9c4,0x9c4
 6d4:	09 00 00 
    base.s.size = 0;
 6d7:	c7 05 c8 09 00 00 00 	movl   $0x0,0x9c8
 6de:	00 00 00 
 6e1:	e9 44 ff ff ff       	jmp    62a <malloc+0x2a>
